﻿<base:AbstractDialogContentControl x:Class="Deployment.Data.UI.Controls.Variable.VariableEditorControl"
                                   xmlns:base="clr-namespace:Deployment.Data.UI.Dialogs"
                                   xmlns:c="clr-namespace:Deployment.Data.UI.Controls.Variable"
                                   xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                                   xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                                   xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
                                   xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
                                   xmlns:y="clr-namespace:Deployment.Data.Variable;assembly=Deployment.Data"
                                   xmlns:v="clr-namespace:Deployment.Data.UI.Converters"
                                   xmlns:data="clr-namespace:Deployment.Data.Variable;assembly=Deployment.Data"
                                   xmlns:b="clr-namespace:Deployment.Data.UI.Controls"
                                   mc:Ignorable="d"
                                   MinWidth="300"
                                   d:DesignHeight="300" d:DesignWidth="300">
    <UserControl.Resources>
        <ObjectDataProvider x:Key="typeDataProvider"
                            ObjectType="{x:Type data:AbstractVariable}"
                            MethodName="getAvailableVariableTypes"/>
        <v:BoolToOppositeBoolConverter x:Key="boolOpposite"/>
        <v:ObjectToAbstraceVariableEditorControl x:Key="ControlConverter"/>
    </UserControl.Resources>
    <DockPanel LastChildFill="True" Margin="8" x:Name="DockPanel">
        <Grid DockPanel.Dock="Top" 
              Width="{Binding ElementName=DockPanel, Path=ActualWidth}"
              IsEnabled="{Binding Path=EditMode, Converter={StaticResource boolOpposite}}">
            <Grid.RowDefinitions>
                <RowDefinition Height="Auto"/>
            </Grid.RowDefinitions>
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="Auto"/>
                <ColumnDefinition Width="*"/>
            </Grid.ColumnDefinitions>

            <Label Grid.Row="0" Grid.Column="0"
                   Content="Variable type:"
                   VerticalAlignment="Center"
                   Margin="2"
                   Padding="2"/>
            <ComboBox Grid.Row="0" Grid.Column="1"
                      VerticalAlignment="Center"
                      x:Name="cbo_VariableType"
                      ItemsSource="{Binding Source={StaticResource typeDataProvider}}"
                      DisplayMemberPath="TypeDescription"
                      Margin="2"
                      Padding="2"/>


        </Grid>
        <b:MyScrollViewer x:Name="contentControl"
                          Content="{Binding Path=SelectedItem, ElementName=cbo_VariableType, Converter={StaticResource ControlConverter}}"
                          ContentChanged="contentControl_ContentChanged"
                          DockPanel.Dock="Top"
                          VerticalScrollBarVisibility="Auto"/>
        <!--<ScrollViewer x:Name="contentControl" 
                      Content="{Binding Path=EditorControl}" 
                      DataContextChanged="contentControl_DataContextChanged"
                      DockPanel.Dock="Top" 
                      ScrollViewer.VerticalScrollBarVisibility="Auto"/>-->
    </DockPanel>
</base:AbstractDialogContentControl>
